<?php
/* @var $this RateController */
/* @var $model Rate */
/* @var $form CActiveForm */
?>

<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'rate-form',
	'enableAjaxValidation'=>false,
)); ?>

	<p class="note"><?php echo Yii::t('base','Fields with <span class="required">*</span> are required.');?></p>

	<?php echo $form->errorSummary($model); ?>

	<div class="row">
		<?php 
		if($model->agent_type==""){
			echo $form->labelEx($model,'agent_type'); 
		}?>
		<?php if($model->agent_type==""){?>
		<?php
		if(yii::app()->user->level==1){
		 	echo $form->dropDownList($model,'agent_type',array('1'=>'一级代理商','2'=>'二级代理商','3'=>'三级代理商')); 
		}?>
		<?php }else{?>
		<?php echo $form->hiddenField($model,'agent_type',array('value'=>$model->agent_type)); ?>
		<?php }?>
		<?php echo $form->error($model,'agent_type'); ?>
	</div>

	<div class="row">
		<?php 
		if($model->package_id==""){
			echo $form->labelEx($model,'package_id'); 
		}?>
		<?php if($model->package_id!=""){?>
		<?php echo $form->hiddenField($model,'package_id',array('value'=>$model->package_id))?>
		<?php }else{?>
		<?php echo $form->dropDownList($model,'package_id',Package::model()->getPackageName());} ?>
		<?php echo $form->error($model,'package_id'); ?>
	</div>
	<div class="row">
	<?php echo $form->labelEx($model,'rate');?>
	<?php echo $form->textField($model,'rate');?>
	<?php echo $form->error($model,'rate');?>
	</div>
	<div class="row">
	<?php echo $form->hiddenField($model,'creater',array('value'=>yii::app()->user->id))?>
	</div>
	<div class="row buttons">
		<?php echo CHtml::submitButton($model->isNewRecord ? Yii::t('base','Create') : Yii::t('base','Save')); ?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->